//
//  HomePublicCell.m
//  PropertyMananger
//
//  Created by bh on 17/3/8.
//  Copyright © 2017年 BH. All rights reserved.
//

#import "HomePublicCell.h"

@implementation HomePublicCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
+ (instancetype)cellWithTableView:(UITableView *)tableView
{
    static NSString *cellID = @"HomePublicCellID";
    HomePublicCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    if(cell == nil) {
        cell = [[HomePublicCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
    }
    //选中cell的颜色 -无色
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    
    
    return cell;
    
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.orderCodeLabel = [[UILabel alloc]init];
        [self.contentView addSubview:self.orderCodeLabel];
        
        self.orderCodeLabel.textColor = BHColor(51, 51, 51);
        self.orderCodeLabel.textAlignment = NSTextAlignmentLeft;
        self.orderCodeLabel.font = BHFont(15);
        self.orderCodeLabel.text = @"订单编号：2323434343433";
        
        [self.orderCodeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.equalTo(self).with.offset(15);
            make.top.equalTo(self).with.offset(12.5);
            make.height.mas_equalTo(25);
        }];
        
        //        self.iconImg = [[UIImageView alloc]init];
        //        [self.contentView addSubview:self.iconImg];
        //        self.iconImg.image = IMG(@"ico_new");
        //
        //        [self.iconImg mas_makeConstraints:^(MASConstraintMaker *make) {
        //            make.leading.equalTo(self.orderCodeLabel.mas_trailing).with.offset(0);
        //            make.top.equalTo(self.orderCodeLabel).with.offset(5);
        //            make.size.mas_equalTo(CGSizeMake(15, 15));
        //        }];
        
        //订单状态
        self.orderProgressLable = [[UILabel alloc]init];
        [self.contentView addSubview:self.orderProgressLable];
        
        self.orderProgressLable.textColor = BHColor(215, 152, 2);
        self.orderProgressLable.textAlignment = NSTextAlignmentCenter;
        self.orderProgressLable.font = BHFont(10);
        self.orderProgressLable.text  = @"待处理";
        //   self.orderProgressLable.backgroundColor = BHRandColor;
        
        self.orderProgressLable.layer.cornerRadius = 3;
        self.orderProgressLable.layer.masksToBounds = YES;
        self.orderProgressLable.layer.borderWidth = 0.5;
       //self.orderProgressLable.layer.borderColor = [UIColor greenColor].CGColor;
        
        [self.orderProgressLable mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.equalTo(self.orderCodeLabel.mas_trailing).with.offset(10);
            make.centerY.equalTo(self.orderCodeLabel).with.offset(0);
            make.size.mas_equalTo(CGSizeMake(40, 25));
        }];
        
        
        
        UIImageView * arrowImg = [[UIImageView alloc]init];
        [self.contentView addSubview:arrowImg];
        arrowImg.image = IMG(@"ico_work_order_next");
        
        [arrowImg mas_makeConstraints:^(MASConstraintMaker *make) {
            make.trailing.equalTo(self).with.offset(-15);
            make.centerY.equalTo(self.orderCodeLabel).with.offset(0);
            make.size.mas_equalTo(CGSizeMake(8, 14));
        }];
        
        UIView * lineView = [[UIView alloc]init];
        [self.contentView addSubview:lineView];
        
        lineView.backgroundColor = BHColor(230, 230, 230);
        [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.equalTo(self).with.offset(0);
            make.size.mas_equalTo(CGSizeMake(BHscreenW, 1));
            make.top.equalTo(self.orderCodeLabel.mas_bottom).with.offset(12.5);
        }];
        //投诉人
        UIImageView * complianManIcon = [[UIImageView alloc]init];
        [self.contentView addSubview:complianManIcon];
        complianManIcon.image = IMG(@"ico_repair_type");
        
        [complianManIcon mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.equalTo(self).with.offset(15);
            make.top.equalTo(lineView).with.offset(15);
            make.size.mas_equalTo(CGSizeMake(20, 20));
        }];
        
        UILabel * complianManLabel = [[UILabel alloc]init];
        [self.contentView addSubview:complianManLabel];
        
        complianManLabel.textColor = BHColor(102, 102, 102);
        complianManLabel.textAlignment = NSTextAlignmentLeft;
        complianManLabel.font = BHFont(15);
        complianManLabel.text  = @"报修类型:";
        
        [complianManLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.equalTo(complianManIcon.mas_trailing).with.offset(10);
            make.centerY.equalTo(complianManIcon).with.offset(0);
            make.size.mas_equalTo(CGSizeMake(70, 25));
        }];
        
        self.repairLabel = [[UILabel alloc]init];
        [self.contentView addSubview:self.repairLabel];
        
        self.repairLabel.textColor = BHColor(51, 51, 51);
        self.repairLabel.textAlignment = NSTextAlignmentLeft;
        self.repairLabel.font = BHFont(15);
        self.repairLabel.text  = @"垃圾桶损坏";
        // self.complianManLabel.backgroundColor = BHRandColor;
        
        [self.repairLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.equalTo(complianManLabel.mas_trailing).with.offset(0);
            make.top.equalTo(complianManLabel).with.offset(0);
            make.size.mas_equalTo(CGSizeMake(BHscreenW/2, 25));
        }];
        
        //投诉地点
        UIImageView * complianTimeIcon = [[UIImageView alloc]init];
        [self.contentView addSubview:complianTimeIcon];
        complianTimeIcon.image = IMG(@"ico_repair_place");
        
        [complianTimeIcon mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.equalTo(self).with.offset(15);
            make.top.equalTo(complianManIcon.mas_bottom).with.offset(30);
            make.size.mas_equalTo(CGSizeMake(20, 20));
        }];
        
        UILabel * complianTimeLabel = [[UILabel alloc]init];
        [self.contentView addSubview:complianTimeLabel];
        
        complianTimeLabel.textColor = BHColor(102, 102, 102);
        complianTimeLabel.textAlignment = NSTextAlignmentLeft;
        complianTimeLabel.font = BHFont(15);
        complianTimeLabel.text  = @"地点:";
        
        [complianTimeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.equalTo(complianTimeIcon.mas_trailing).with.offset(10);
            make.centerY.equalTo(complianTimeIcon).with.offset(0);
            make.size.mas_equalTo(CGSizeMake(40, 25));
        }];
        
        self.placeLabel = [[UILabel alloc]init];
        [self.contentView addSubview:self.placeLabel];
        
        self.placeLabel.textColor = BHColor(51, 51, 51);
        self.placeLabel.textAlignment = NSTextAlignmentLeft;
        self.placeLabel.font = BHFont(15);
        self.placeLabel.text  = @"3号楼2栋一单元2号电梯垃圾桶";
        //   self.timeLabel.backgroundColor = BHRandColor;
        
        [self.placeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.equalTo(complianTimeLabel.mas_trailing).with.offset(5);
            make.top.equalTo(complianTimeLabel).with.offset(0);
            make.size.mas_equalTo(CGSizeMake(BHscreenW - 60, 25));
        }];
        
        //报修人
        UIImageView * contentIcon = [[UIImageView alloc]init];
        [self.contentView addSubview:contentIcon];
        contentIcon.image = IMG(@"ico_repair_people");
        
        [contentIcon mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.equalTo(self).with.offset(15);
            make.top.equalTo(complianTimeIcon.mas_bottom).with.offset(30);
            make.size.mas_equalTo(CGSizeMake(20, 20));
        }];
        
        UILabel * contentLabel = [[UILabel alloc]init];
        [self.contentView addSubview:contentLabel];
        
        contentLabel.textColor = BHColor(102, 102, 102);
        contentLabel.textAlignment = NSTextAlignmentLeft;
        contentLabel.font = BHFont(15);
        contentLabel.text  = @"报修人:";
        
        [contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.equalTo(contentIcon.mas_trailing).with.offset(10);
            make.centerY.equalTo(contentIcon).with.offset(0);
            make.size.mas_equalTo(CGSizeMake(60, 25));
        }];
        
        self.repairManLabel = [[UILabel alloc]init];
        [self.contentView addSubview:self.repairManLabel];
        
        self.repairManLabel.textColor = BHColor(51, 51, 51);
        self.repairManLabel.textAlignment = NSTextAlignmentLeft;
        self.repairManLabel.font = BHFont(15);
        self.repairManLabel.numberOfLines = 5;
        //   self.contentLabel.backgroundColor = BHRandColor;
        self.repairManLabel.text  = @"吴敏";
        
        [self.repairManLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.equalTo(contentLabel.mas_trailing).with.offset(0);
            make.top.equalTo(contentLabel).with.offset(0);
            make.size.mas_equalTo(CGSizeMake(BHscreenW/2, 25));
            
        }];        
        
    }
    return self;
}

@end
